expression: Fix property expressions for interfaces
authorMatthias Clasen <mclasen@redhat.com>
Sat, 31 Oct 2020 02:24:53 +0000 (22:24 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 31 Oct 2020 02:27:40 +0000 (22:27 -0400)
We were not checking the passed-in type in the right
way. An interface type can still pass the
g_type_is_a (..., G_TYPE_OBJECT) check, if G_TYPE_OBJECT
is one of its prerequisites. What we need to check is
whether the fundamental type is G_TYPE_OBJECT.

gtk/gtkexpression.c

index f7c25f9c7350e03febd4161f79be6c3ac99c82c4..0974face668739f36d5c99c72d6fca0d7044527e 100644 (file)
@@ -1283,13 +1283,13 @@ gtk_property_expression_new (GType          this_type,
 {
   GParamSpec *pspec;
 
-  if (g_type_is_a (this_type, G_TYPE_OBJECT))
+  if (g_type_fundamental (this_type) == G_TYPE_OBJECT)
     {
       GObjectClass *class = g_type_class_ref (this_type);
       pspec = g_object_class_find_property (class, property_name);
       g_type_class_unref (class);
     }
-  else if (g_type_is_a (this_type, G_TYPE_INTERFACE))
+  else if (g_type_fundamental (this_type) == G_TYPE_INTERFACE)
     {
       GTypeInterface *iface = g_type_default_interface_ref (this_type);
       pspec = g_object_interface_find_property (iface, property_name);